//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeletePicture {
        private readonly IPictureRepository _PictureRepository;

        public DeletePicture(IPictureRepository PictureRepository) {
            _PictureRepository = PictureRepository;
        }

        public virtual void Execute(Guid pictureId) {
            var PictureToDelete = _PictureRepository.GetPicture(pictureId);

            if (PictureToDelete != null) {
                _PictureRepository.Delete(pictureId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
